package org.spider.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.spider.mapper.SpiderAuthUserMapper;
import org.spider.model.entity.SpiderAuthUserEntity;
import org.spider.service.SpiderAuthRoleService;
import org.spider.service.SpiderAuthUserService;
import org.spider.user.entity.User;
import org.spider.user.entity.UserInfo;
import org.spider.user.entity.UserOauth;
import org.spider.user.excel.UserExcel;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lzy
 * @since 2022-06-02 15:30:30
 */
@Service
public class SpiderAuthUserServiceImp extends ServiceImpl<SpiderAuthUserMapper, SpiderAuthUserEntity> implements SpiderAuthUserService {

    @Autowired
    SpiderAuthRoleService spiderAuthRoleService;

    @Override
    public boolean submit(User user) {
        return false;
    }

    @Override
    public IPage<User> selectUserPage(IPage<User> page, User user) {
        return null;
    }

    @Override
    public UserInfo userInfo(Long userId) {
        return null;
    }

    @Override
    public UserInfo userInfo(String tenantId, String account, String password) {
        UserInfo userInfo = new UserInfo();
        SpiderAuthUserEntity spiderAuthUserEntity = baseMapper.getUser(tenantId, account, password);
        userInfo.setSpiderAuthUserEntity(spiderAuthUserEntity);
        if (Func.isNotEmpty(spiderAuthUserEntity)) {
            userInfo.setRoles(spiderAuthRoleService.getRoleName(spiderAuthUserEntity.getId()));
        }
        return userInfo;
    }

    @Override
    public UserInfo userInfo(UserOauth userOauth) {
        return null;
    }

    @Override
    public boolean grant(String userIds, String roleIds) {
        return false;
    }

    @Override
    public boolean resetPassword(String userIds) {
        return false;
    }

    @Override
    public boolean updatePassword(Long userId, String oldPassword, String newPassword, String newPassword1) {
        return false;
    }

    @Override
    public List<String> getRoleName(String roleIds) {
        return null;
    }

    @Override
    public List<String> getDeptName(String deptIds) {
        return null;
    }

    @Override
    public void importUser(List<UserExcel> data) {

    }

    @Override
    public List<UserExcel> exportUser(Wrapper<User> queryWrapper) {
        return null;
    }

    @Override
    public boolean registerGuest(User user, Long oauthId) {
        return false;
    }
}
